﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for EmployeeBLL
/// </summary>

public class CardTypeBLL : ICardTypeBLL
{
    //inject DAL
    private ICardTypeDAL cardTypeDAL = Factory<ICardTypeDAL>.CreateInstance();

    public CardTypeBLL()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    /// <summary>
    /// GetAll
    /// </summary>
    /// <returns>List<CardType></returns>
    public List<CardType> GetAll()
    {
        try
        {
            return cardTypeDAL.GetAll();
        }
        catch (Exception)
        {
            throw;
        }
    }


    /// <summary>
    /// 
    /// </summary>
    /// <param name="id">Guid</param>
    /// <returns>CardType</returns>
    public CardType GetById(Guid id)
    {
        try
        {
            return cardTypeDAL.GetById(id);
        }
        catch (Exception)
        {
            throw;
        }
    }

    

    /// <summary>
    /// InsertOrUpdate
    /// </summary>
    /// <param name="emp">emp</param>
    /// <returns>CardType</returns>
    public bool InsertOrUpdate(CardType cardType)
    {
        try
        {
            return cardTypeDAL.InsertOrUpdate(cardType);
        }
        catch (Exception)
        {
            throw;
        }
    }

    /// <summary>
    /// Delete
    /// </summary>
    /// <param name="id">Guid</param>
    /// <returns>bool</returns>
    public bool Delete(Guid id)
    {
        try
        {
            return cardTypeDAL.Delete(id);
        }
        catch (Exception)
        {
            throw;
        }
    }

    public bool IsExistCardType(string name)
    {
        try
        {
            return cardTypeDAL.IsExistCardType(name);
        }
        catch (Exception)
        {
            throw;
        }
    }   
}

